package com.homedo.odin.solution.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.homedo.core.common.base.service.BaseService;
import com.homedo.odin.solution.dao.BountyReplyMapper;
import com.homedo.odin.solution.model.dto.PageBean;
import com.homedo.odin.solution.model.entity.BountyReply;
import com.homedo.odin.solution.model.entity.BountyReplyBean;
import org.springframework.stereotype.Service;

/**
 * <p> 悬赏回复 服务实现类 </p>
 *
 * @author HarveyDing
 * @since 2018-03-08
 */
@Service
public class BountyReplyServiceImpl extends BaseService<BountyReplyMapper, BountyReply> {


    /**
     * 根据悬赏ID获取悬赏回复列表
     */
    public PageInfo<BountyReplyBean> getBountyReplyList(PageBean pageBean, int bountyId) {
        PageHelper.startPage(pageBean.getCurrentPage(), pageBean.getPageSize());
        return new PageInfo<BountyReplyBean>(baseMapper.getBountyReplyList(bountyId));
    }

    /**
     * 获取我的悬赏回复
     */
    public PageInfo<BountyReplyBean> getMyBountyReplyList(PageBean pageBean, int userId, int isAdopt, long startTime,
            long endTime) {
        PageHelper.startPage(pageBean.getCurrentPage(), pageBean.getPageSize());
        return new PageInfo<BountyReplyBean>(baseMapper.getMyBountyReplyList(userId, isAdopt, startTime, endTime));
    }

}
